<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
  <title>Haru Free PDF Library</title>
  <meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1">
  <link href="api.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id="headcontainer">
<div class="head"><img alt="Haru Free PDF Library"
 src="image/harulogo.png" style="width: 413px; height: 40px;"></div>
</div>
<div id="barcontainer">
<div class="buildbar"><a href="index.html">home</a> | <a
 href="http://sourceforge.net/project/showfiles.php?group_id=83044">download</a>
|
<a href="documentation.html">documentation</a> | <a
 href="examples.html">examples </a>| <a
 href="http://sourceforge.net/projects/libharu/">sourceforge</a> |
<a href="http://sourceforge.net/forum/?group_id=83044">forums</a><br>
</div>
</div>
<div id="container">
<div id="mainpage">
<div id="ccol">
<h2>Font Functions<br>
</h2>
<h3><a name="HPDF_Font_GetFontName_"></a>HPDF_Font_GetFontName<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
<span style="font-weight: bold;">const </span>char *<br>
HPDF_Font_GetFontName&nbsp; (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetFontName() gets the name of the font.<br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of an font object.<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetFontName() succeed, it returns the name of the font.
Otherwise, it returns NULL.<br>
</div>
<br>
<h3>HPDF_Font_GetEncodingName<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
<span style="font-weight: bold;">const </span>char *<br>
HPDF_Font_GetEncodingName&nbsp; (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetEncodingName() gets the encoding name of the font.<br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetEncodingName() succeed, it returns the encoding name
of the font. Otherwise, it returns NULL.<br>
</div>
<br>
<h3>HPDF_Font_GetUnicodeWidth<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_INT<br>
HPDF_Font_GetUnicodeWidth&nbsp;
(HPDF_Font&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; font,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HPDF_UNICODE&nbsp;&nbsp;&nbsp; code);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetUnicodeWidth() gets the width of a charactor in the font.<br>
Actual width of the character on the page can be calculated by the
following <br>
expressions. <br>
<br>
<div class="bodycode"><br>
char_width = HPDF_Font_GetUnicodeWidth (font, UNICODE);<br>
float actual_width = char_width * FONT_SIZE / 1000;<br>
<br>
</div>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of an font object.<br>
</div>
<br>
<span style="font-weight: bold;">code</span><br>
<div class="bodytext5">A unicode of the charactor.<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetUnicodeWidth() succeed, it returns the width of the
font. Otherwise it returns 0.<br>
<br>
<br>
</div>
<h3><a name="HPDF_Font_GetBBox_"></a>HPDF_Font_GetBBox<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
typedef&nbsp; struct _HPDF_Rect {<br>
&nbsp;&nbsp;&nbsp; HPDF_REAL&nbsp; left;<br>
&nbsp;&nbsp;&nbsp; HPDF_REAL&nbsp; bottom;<br>
&nbsp;&nbsp;&nbsp; HPDF_REAL&nbsp; right;<br>
&nbsp;&nbsp;&nbsp; HPDF_REAL&nbsp; top;<br>
} HPDF_Rect;<br>
<br>
typedef struct _HPDF_Rect HPDF_Box;<br>
<br>
HPDF_Box<br>
HPDF_Font_GetBBox&nbsp; (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetBBox() gets the bounding box of the font.<br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetBox() succeed, it returns the HPDF_Box struct
specifying the font bounding box.
Otherwise, it returns a HPDF_Box struct of {0, 0, 0, 0}.<br>
</div>
<br>
<h3><a name="HPDF_Font_GetAscent_"></a>HPDF_Font_GetAscent<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_INT<br>
HPDF_Font_GetAscent (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetAscent() gets the vertical ascent of the font. <br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetAscent() succeed, it returns vertical ascent of the
font. Otherwise, it returns 0.<br>
</div>
<br>
<h3><a name="HPDF_Font_GetDescent_"></a>HPDF_Font_GetDescent<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_INT<br>
HPDF_Font_GetDescent (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetDescent() gets the vertical descent of the font. <br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetDescent() succeed, it returns vertical descent of the
font. Otherwise, it returns 0.<br>
</div>
<br>
<h3><a name="HPDF_Font_GetXHeight_"></a>HPDF_Font_GetXHeight<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_UINT<br>
HPDF_Font_GetXHeight&nbsp; (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetXHeight() gets the distance from the baseline of lowercase
letters. <br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetXHeight() succeed, it returns the x-height's value of
the font. Otherwise, it returns 0.<br>
</div>
<br>
<h3><a name="HPDF_Font_GetCapHeight_"></a>HPDF_Font_GetCapHeight<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_UINT<br>
HPDF_Font_GetCapHeight (HPDF_Font&nbsp;&nbsp;&nbsp; font);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_GetCapHeight() gets the distance from the baseline of
uppercase letters. <br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_GetCapHeight() succeed, it returns the cap-height's
value of the font. Otherwise, it returns 0.<br>
</div>
<br>
<h3><a name="HPDF_Font_TextWidth_"></a>HPDF_Font_TextWidth<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
typedef struct _HPDF_TextWidth {<br>
&nbsp;&nbsp;&nbsp; HPDF_UINT numchars;<br>
&nbsp;&nbsp;&nbsp; HPDF_UINT numwords;<br>
&nbsp;&nbsp;&nbsp; HPDF_UINT width;<br>
&nbsp;&nbsp;&nbsp; HPDF_UINT numspace;<br>
} HPDF_TextWidth;<br>
<br>
HPDF_TextWidth<br>
HPDF_Font_TextWidth&nbsp;
(HPDF_Font&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; font,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
const HPDF_BYTE&nbsp;&nbsp; *text,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HPDF_UINT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_TextWidth() gets total width of the text, number of
charactors and number of the words. <br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">The handle of a font object.
</div>
<br>
<span style="font-weight: bold;">text</span><br>
<div class="bodytext5">The text to get width.
</div>
<br>
<span style="font-weight: bold;">len</span><br>
<div class="bodytext5">The byte length of the text.<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_TextWidth() succeed, it returns a HPDF_TextWidth struct
including calculation result. Otherwise, it returns a HPDF_TextWidth
struct whose attributes are all ZERO.</div>
<br>
<h3><a name="HPDF_Font_MeasureText_"></a>HPDF_Font_MeasureText<br>
</h3>
<div class="bodytext1">
<div class="bodycode2"><span style="font-weight: bold;">#include</span>
"apdf.h"<br>
<br>
HPDF_UINT<br>
HPDF_Font_MeasureText
(HPDF_Font&nbsp;&nbsp;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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HPDF_REAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
word_space,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HPDF_BOOL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
wordwrap,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HPDF_REAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *real_width);<br>
<br>
</div>
<h4>Description<br>
</h4>
HPDF_Font_MeasureText() calculates the byte length which can be
included within the specified width.<br>
<br>
<h4>Parameter</h4>
<span style="font-weight: bold;">font</span>
<div class="bodytext5">Specify the handle of a font object.<br>
<br>
</div>
<span style="font-weight: bold;">text</span>
<div class="bodytext5">A text that is used to calculate.<br>
<br>
</div>
<span style="font-weight: bold;">len</span><br>
<div class="bodytext5">The length of the text.<br>
<br>
</div>
<span style="font-weight: bold;">width</span><br>
<div class="bodytext5">The width of the area to put the text.<br>
<br>
</div>
<span style="font-weight: bold;">font_size</span><br>
<div class="bodytext5">The size of the font.<br>
<br>
</div>
<span style="font-weight: bold;">char_space</span><br>
<div class="bodytext5">The character spacing.<br>
<br>
</div>
<span style="font-weight: bold;">word_space</span><br>
<div class="bodytext5">The word spacing.<br>
<br>
</div>
<span style="font-weight: bold;">wordwrap</span><br>
<div class="bodytext5">When there are three words of "ABCDE", "FGH",
and "IJKL", and the substring until "J" can be included within the
width, if word_wrap parameter is HPDF_FALSE it returns 12,&nbsp; and if
word_wrap parameter is HPDF_FALSE word_wrap parameter is HPDF_FALSE it
returns 10 (the end of the previous word).<br>
<img alt="figure9" src="image/figure9.png"
 style="width: 286px; height: 83px;"><br>
</div>
<br>
<span style="font-weight: bold;">real_width</span><br>
<div class="bodytext5">If this parameter is not NULL, the real widths
of the text is set. An application can set it to NULL if it is
unnecessary<br>
</div>
<br>
<h4>Returns</h4>
When HPDF_Font_SetColorMask() succeed, it returns the byte length which
can be included within the specified width.
Otherwise it returns 0.<br>
</div>
<br>
<br>
<br>
<br>
</div>
</div>
<div id="lcol">
<div class="sidebar">
<ul>
</ul>
<ul>
  <li><a href="#HPDF_Font_GetFontName_">HPDF_Font_GetFontName</a></li>
  <li><a href="#HPDF_Font_GetBBox_">HPDF_Font_GetBBox</a></li>
  <li><a href="#HPDF_Font_GetAscent_">HPDF_Font_GetAscent</a></li>
  <li><a href="#HPDF_Font_GetDescent_">HPDF_Font_GetDescent</a></li>
  <li><a href="#HPDF_Font_GetXHeight_">HPDF_Font_GetXHeight</a></li>
  <li><a href="#HPDF_Font_GetCapHeight_">HPDF_Font_GetCapHeight</a></li>
  <li><a href="#HPDF_Font_TextWidth_">HPDF_Font_TextWidth</a></li>
  <li><a href="#HPDF_Font_MeasureText_">HPDF_Font_MeasureText</a></li>
</ul>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</body>
</html>
